/**
 * Fish.java
 * Subclasses of Aqualife are fish, and whale.
 * Fish has an attribute which stores whether the fish is a
 * herbivore or a carnivore.
 *
 * The eat method checks whether herbivore and prints ‘This fish eats veggies’
 * for herbivores and prints ‘This fish eats other fish’ for carnivores.
 *
 * The procreates method prints ‘Fish lay eggs’
 *
 *  @author  John Thomason
 *    Date:  Nov 22, 2008
 *  Course:  CS222 Java II
 * Seminar:  3
 *  Assign:  Mid Term Exam
 */


/**
 * Fish Class
 */
public class Fish 
extends Aqualife {

//INSTANCE VARS

    public enum Predation { HERBIVORE, CARNIVORE };
    private Predation pred;
    private FishType  type;


//CONSTRUCTORS

    /**
     * Fish()
     * Provides default values for a fish
     */
    public Fish(){
        this(FishType.LAKE, Predation.HERBIVORE, "Blue Gill", 1);
    }

    /**
     * Fish(FishType,Predation,String,Integer)
     * Provides the Fish instance with necessary values set
     *
     * @param type  The type of fish [lake | ocean]
     * @param pred  The type of preditor [herbivore | carnivore]
     * @param name  The name of the fish
     * @param age   The age of the fish
     */
    public Fish(FishType type, Predation pred, String name, Integer age){
        super(name,age);
        this.type = type;
        this.pred = pred;
    }

    
//CONCRETE METHODS

    /**
     * getType()
     * Returns a string representing the 'type' of fish
     *
     * @return  The fish type as a string in lowercase
     */
    public String getType(){
        return type.name().toLowerCase();
    }//getType()


//CONCRETE IMPLEMENTATIONS

    /**
     * eat()
     * What this fish eats?
     * 
     * @return  What the fish eats as a string
     */
    public String eat(){
        String p = "";
        switch(pred){
            case HERBIVORE:
                p = "veggies";
                break;
            case CARNIVORE:
                p = "other fish";
                break;
        }//switch
        return String.format("they eat %s", p);
    }//eat()

    /**
     * procreates()
     * What fish spawn?
     *
     * @return  What fish spawn as a string
     */
    public String procreates(){
        return "Fish lay eggs.";
    }


//OVERRIDDEN METHODS

    /**
     * toString()
     * A string representing a Fish object
     *
     * @return  This fishes characteristics
     */
    @Override
    public String toString(){
        return String.format("%s is a %s fish, and %s.\n  %s\n  %s\n",
                getName(), getType(), eat(), breathes(), procreates());
    }//toString()

}//End Fish Class
